package com.baiqian.doupo.particle;

import net.minecraft.client.particle.IAnimatedSprite;
import net.minecraft.client.particle.IParticleFactory;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.world.ClientWorld;

public class DouQiParticleFactory implements IParticleFactory<DouQiParticleData> {
    private final IAnimatedSprite sprites;

    public DouQiParticleFactory(IAnimatedSprite sprite) {
        this.sprites = sprite;
    }

    @Override
    public Particle makeParticle(DouQiParticleData typeIn, ClientWorld worldIn, double x, double y, double z,
                                 double xSpeed, double ySpeed, double zSpeed) {
        DouQiParticle particle = new DouQiParticle(worldIn, x, y, z, typeIn.getSpeed(), typeIn.getColor(),
                typeIn.getDiameter());
        particle.selectSpriteRandomly(sprites);//这句话的意思是随机加载我们例子效果json文件里的一个材质
        return particle;
    }
}
